package cn.xuchunh.sword;

/**
 * Created by XuChunH on 2016/9/12.
 */
public class Main {

    public static void main(String[] args) {
        leftRotateString();
    }

    private static void checkStackPushPop() {
        CheckStackPushPop checkStackPushPop = new CheckStackPushPop();
        int[] push = {1, 2, 3, 4, 5};
//        int[] pop = {4, 5, 3, 2, 1};
        int[] pop = {4, 3, 5, 1, 2};
        System.out.println(checkStackPushPop.IsPopOrder(push, pop));
    }

    private static void printFromTopToBottom() {
        TreeNode treeNode = new TreeNode(10);
        System.out.println(new PrintTree().PrintFromTopToBottom(treeNode));
    }

    private static void power() {
        System.out.println(new Power().power(3.2, -7));
    }

    private static void verifySquenceOfBST() {
        System.out.println(new VerifySquenceOfBST().verifySquenceOfBST(new int[]{1, 2}));
    }

    private static void findPath() {
        TreeNode treeNode = new TreeNode(1);
        System.out.println(new FindPath().findPath(treeNode, 2));
    }

    private static void linkedListClone() {
        RandomListNode randomListNode1 = new RandomListNode(1);
        RandomListNode randomListNode2 = new RandomListNode(2);
        RandomListNode randomListNode3 = new RandomListNode(3);
        RandomListNode randomListNode4 = new RandomListNode(4);
        RandomListNode randomListNode5 = new RandomListNode(5);
        randomListNode1.next = randomListNode2;
        randomListNode2.next = randomListNode3;
        randomListNode3.next = randomListNode4;
        randomListNode4.next = randomListNode5;
        randomListNode1.random = randomListNode3;
        randomListNode2.random = randomListNode5;
        randomListNode4.random = randomListNode2;
        RandomListNode clone = new LinkedListClone().clone(randomListNode1);
        RandomListNode temp = clone;
        while (clone != null) {
            System.out.println(clone.label);
            clone = clone.next;
        }
        while (temp != null) {
            if (temp.random != null) {
                System.out.println(temp.random.label);
            } else {
                System.out.println("#");
            }
            temp = temp.next;
        }
    }

    private static void printMinNumber() {
        System.out.println(new PrintMinNumber().printMinNumber(new int[]{3, 32, 321}));
    }

    private static void findUglyNumber(){
        System.out.println(new GetUglyNumber().solution(7));
    }

    private static void leftRotateString(){
        System.out.println(new LeftRotateString().solution("abcXYZdef", 3));
    }

}
